﻿using BLL;
using models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace yuejilalala
{
    public partial class Pe2 : System.Web.UI.Page
    {
        UserMarager marager = new UserMarager();
        CartMarager cartMarager = new CartMarager();

        int mobile_code;
        protected void Page_Load(object sender, EventArgs e)
        {
            User user = Session["sess"] as User;
            this.mobile.Text = user.Phone.ToString();
            if (!IsPostBack)
            {
                if(Session["sess"] == null)
                {
                    Response.Redirect("Login.aspx");
                }
                if (Session["sessid"] != null)
                {

                    J_MiniCartNum.Text = cartMarager.CartCount((Session["sessid"].ToString())).ProPrice.ToString();//显示出购物车内物品.数量
                }
            }
            userDl();
        }


        //登陆在左上方显示用户名方法					
        public void userDl()
        {
            if (Session["sess"] != null)
            {
                //用户存在则显示出来 并且隐藏注册和登陆显示
                User user = Session["sess"] as User;
                hl_dlm.Text = "用户名:" + user.UName;
                hl_dlm.Visible = true;//显示登陆名控件
                hl_dl.Visible = false;//请登陆隐藏
                hl_zc.Visible = false;//注册隐藏
            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
           
            User user = Session["sess"] as User;

         
            mobile_code =int.Parse( Session["mobile_code"].ToString());
            if (TextBox1.Text == mobile_code.ToString())
            {

                Response.Redirect("Phone.aspx");
                Response.Write("<script>alert('成功')</script>");
               
                
            }
            else
            {
                Response.Write("<script>alert('修改失败')</script>");
            }
        }
    }
}